package 面向对象.课堂练习;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.MalformedParameterizedTypeException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class Day12_6 {
    public static void main(String[] args) throws MalformedParameterizedTypeException, MalformedURLException {
        URL url = new URL("https://blog.csdn.net/");
        try {
            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
            InputStream inputStream = urlConnection.getInputStream();
            byte[] buffer = new byte[1024];
            inputStream.read(buffer);
            System.out.println(new String(buffer, StandardCharsets.UTF_8));
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
